//
//  RootMakeSureTheOrderTableViewCell.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/8/9.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "RootMakeSureTheOrderTableViewCell.h"

@interface RootMakeSureTheOrderTableViewCell ()

Strong UILabel *nameLabel;
Strong UILabel *moneyLabel;
Strong UIView *lineView;

@end

@implementation RootMakeSureTheOrderTableViewCell

- (id)initWithCellIdentifier:(NSString *)cellID{
    self = [super initWithCellIdentifier:cellID];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        _nameLabel  = [[UILabel alloc]init];
        _nameLabel.font = DEF_FontSize_14;
        _nameLabel.textColor = getColor(textColor);
        [self.contentView addSubview:_nameLabel];
        
        _moneyLabel  = [[UILabel alloc]init];
        _moneyLabel.font = DEF_FontSize_14;
        _moneyLabel.textColor = getColor(textColor);
        _moneyLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_moneyLabel];
        
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = getColor(dividerColor);
        [self.contentView addSubview:_lineView];
        
        [self layoutFrame];
    }
    return self;
}

- (void)layoutFrame{
    __weak __typeof(self)weakSelf = self;
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10 / WIDTH_5S_SCALE);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10 / WIDTH_5S_SCALE);
        make.top.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10 / WIDTH_5S_SCALE);
        make.bottom.mas_equalTo(0);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH - 20 / WIDTH_5S_SCALE, 0.5));
    }];
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.nameLabel.text = model[@"goods_name"];
    self.moneyLabel.text = [NSString stringWithFormat:@"x %@      ¥%@",model[@"log_num"],model[@"price"]];
}


@end
